import xlrd
import numpy as np

wd=xlrd.open_workbook(filename=r"D:\Desktop\day8\百度数据分析\ABC.xls",encoding_override=True)

sheet=wd.sheet_by_index(0)
# wd.sheet_by_name(0)
print(sheet.ncols)
print("总人数为",sheet.nrows-1)


gongsi=set("传媒")
nan=0
nv=0
dianxin=0
yidong=0
liantong=0
lao=0
gaoxin=0
dixin=0
chuan=0
diqu=0
for i in range(sheet.ncols):
    if sheet.col_values(i)[0]=="性别":
        x=sheet.col_values(i)
        for y in x:
            if y=="男":
                nan=nan+1
            elif y=="女":
                nv=nv+1
        print("男生：", nan, "女生：", nv)
    elif sheet.col_values(i)[0]=="电话号码":
        d = sheet.col_values(i)[1:]
        for p in d:
            if int(p)//1000000000==14 or int(p)//1000000000== 17:
                dianxin+=1
            elif int(p) // 1000000000 == 13:
                yidong+=1
            elif  int(p)//1000000000==15:
                liantong+=1
        print("电信",dianxin,"联通",liantong,"移动",yidong )
    elif sheet.col_values(i)[0]=="年龄":
        n=sheet.col_values(i)[1:]
        for s in n:
            if s>45:
                lao+=1
        print("老员工人数",lao)
    elif sheet.col_values(i)[0]=="薪资":
        x=sheet.col_values(i)[1:]
        for xin in x:
            if xin>8000:
                gaoxin+=1
            elif xin<3000:
                dixin+=1
        print("大于8000元的人数",gaoxin,"低于3000元的人数",dixin)
    elif sheet.col_values(i)[0]=="外包公司":

        i=sheet.col_values(i)[1:]
        for y in i:
            si=set(y)
            if si & gongsi:
                chuan+=1
        print("传媒公司的人数",chuan)
    elif sheet.col_values(i)[0]=="居住地址":
        i=sheet.col_values(i)[1:]
        for y in i:
            q=y[:2]
            if q=="黑龙" or q=="四川" or q=="福建" or q=="北京":
                diqu+=1
        print("在高风险地区人数",diqu)



